package com.aoxin.util.weiXinPay.xmlUntil;


import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * User: rizenguo
 * Date: 2014/10/23
 * Time: 14:59
 */
public class Util {



    public static InputStream getStringStream(String sInputString) {
        ByteArrayInputStream tInputStringStream = null;
        if (sInputString != null && !sInputString.trim().equals("")) {
            tInputStringStream = new ByteArrayInputStream(sInputString.getBytes());
        }
        return tInputStringStream;
    }
    //读取properties
    public static Map<String,String> getPropertisValues (String filePath) {
    	Properties properties =new Properties();
    	Map<String, String> map=new HashMap<>();
    	try {
			InputStream inputStream=new BufferedInputStream(new FileInputStream(filePath));
			properties.load(inputStream);
			Iterator<String> iterator=properties.stringPropertyNames().iterator();
			while(iterator.hasNext()){
				String key=iterator.next();
				map.put(key, properties.get(key).toString());
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	}
    public static int[] getHashcode(List<String> list){
		int [] is=new int[list.size()];
		for(int i=0;i<list.size();i++){
			is[i]=list.get(i).hashCode()&0x1f4;
		}
		return is;
	}
    public static int getHashcode(String str){
		int is=str.hashCode()&0x1f4;
		return is;
	}
    public static void main(String[] args) {
    	List<String> list=new ArrayList<String>();
    	list.add("网点");
    	list.add("星辰二汽网点");
    	
    	int[] hashcode = getHashcode(list);
    	for(int i:hashcode) {
    		System.out.println(i);
    	}
	}
}

